Direct Web Remoting
   HOME

TheInfoList



OR:

Direct Web Remoting, or DWR, is a
Java Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's List ...
open-source Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
library that helps developers write web sites that include
Ajax Ajax may refer to: Greek mythology and tragedy * Ajax the Great, a Greek mythological hero, son of King Telamon and Periboea * Ajax the Lesser, a Greek mythological hero, son of Oileus, the king of Locris * ''Ajax'' (play), by the ancient Greek ...
technology. It allows code in a web browser to use Java functions running on a web server as if those functions were within the browser. The DWR project was started by Joe Walker in 2004, 1.0 released at August 29, 2005.


Application

*Code to allow
JavaScript JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of Website, websites use JavaScript on the Client (computing), client side ...
to retrieve data from a
servlet A Jakarta Servlet (formerly Java Servlet) is a Java software component that extends the capabilities of a server. Although servlets can respond to many types of requests, they most commonly implement web containers for hosting web application ...
-based web server using Ajax principles. *A JavaScript library that makes it easier for the website developer to dynamically update the web page with the retrieved data. DWR takes a novel approach to Ajax by dynamically generating JavaScript code based on Java classes. Thus the web developer can use Java code from JavaScript as if it were local to the web browser; whereas in reality the Java code runs in the web server and has full access to web server resources. For security reasons the web developer must configure exactly which Java classes are safe to export (which is often called ''web.xml'' or ''dwr.xml''). This method of remoting functions from Java to JavaScript gives DWR users a feel much like conventional RPC mechanisms like RMI or
SOAP Soap is a salt of a fatty acid used in a variety of cleansing and lubricating products. In a domestic setting, soaps are surfactants usually used for washing, bathing, and other types of housekeeping. In industrial settings, soaps are use ...
, with the benefit that it runs over the web without requiring web browser plug-ins. DWR does not consider the web browser / web server protocol to be important, and prefers to ensure that the programmer's interface is natural. The greatest challenge to this is to marry the asynchronous nature of Ajax with the synchronous nature of normal Java method calls. In the asynchronous model, result data is only available some time after the initial call is made. DWR solves this problem by allowing the web developer to specify a function to be called when the data is returned using an extra method parameter. This extra method is called CallBack Method. The value returned from the java function will be passed to the callback method. Here is a sample Callback: MJavaClassOnJs.getListProducts(selectedCategory,) The callback is that function inside the
JSON JSON (JavaScript Object Notation, pronounced ; also ) is an open standard file format and data interchange format that uses human-readable text to store and transmit data objects consisting of attribute–value pairs and arrays (or other ser ...
object passed as an additional parameter to the remoted function. With version 2.0, DWR supports Comet (also called "Reverse Ajax) where Java code running on the server can deliberately send dedicated JavaScript to a browser.


References


Bibliography

*


External links

*{{Official website Ajax (programming) JavaScript XML software Software using the Apache license Web frameworks 2005 software Free software programmed in Java (programming language)